package github.leavesczy.reactivehttpsamples.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.chad.library.adapter4.BaseQuickAdapter
import github.leavesczy.reactivehttpsamples.core.mode.ExtraImage
import github.leavesczy.reactivehttpsamples.core.mode.ResulData
import github.leavesczy.reactivehttpsamples.databinding.AdapterResultImageItemBinding

class BridgeResultImageAdapter : BaseQuickAdapter<ExtraImage, BridgeResultImageAdapter.VH>() {

    class VH(val bind: AdapterResultImageItemBinding) : RecyclerView.ViewHolder(bind.root)

    init {

    }

    override fun onCreateViewHolder(
        context: Context,
        parent: ViewGroup,
        viewType: Int
    ): BridgeResultImageAdapter.VH {
        val inflate =
            AdapterResultImageItemBinding.inflate(LayoutInflater.from(context), parent, false)
        return VH(inflate)
    }

    override fun onBindViewHolder(holder: VH, position: Int, item: ExtraImage?) {
        item?.let {
            holder.bind.tvImageName.text=it.name
            Glide.with(holder.bind.ivImage)
                .load(it.url)
                .into(holder.bind.ivImage)
        }

    }


}


